From: Jonas Ã…dahl Date: Thu, 29 Aug 2024 13:26:39 +0000 (+0200) Subject: ibus-candidate-popup: Scale coordinates from IBus X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~219^2^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6982f2daaef184e7cb9ccf1f5259f971b42c3e57;p=gnome-shell.git ibus-candidate-popup: Scale coordinates from IBus The coordinates are effectively in the windowing system coordinate space, which when scaling Xwayland, we need to scale these. Do this with the Meta.Window.protocol_to_stage() function on the focused window, which handles it correctly for the corresponding windowing system and configuration. Part-of: --- diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index f0f4f1a36..5e9ac853f 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -1,6 +1,7 @@ import Clutter from 'gi://Clutter'; import GObject from 'gi://GObject'; import IBus from 'gi://IBus'; +import Mtk from 'gi://Mtk'; import St from 'gi://St'; import * as BoxPointer from './boxpointer.js'; @@ -203,14 +204,29 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer { return; panelService.connect('set-cursor-location', (ps, x, y, w, h) => { - this._setDummyCursorGeometry(x, y, w, h); + const focusWindow = global.display.focus_window; + let rect = new Mtk.Rectangle({x, y, width: w, height: h}); + if (!global.stage.key_focus && focusWindow) + rect = focusWindow.protocol_to_stage_rect(rect); + this._setDummyCursorGeometry( + rect.x, + rect.y, + rect.width, + rect.height); }); try { panelService.connect('set-cursor-location-relative', (ps, x, y, w, h) => { - if (!global.display.focus_window) + const focusWindow = global.display.focus_window; + if (!focusWindow) return; - let window = global.display.focus_window.get_compositor_private(); - this._setDummyCursorGeometry(window.x + x, window.y + y, w, h); + let rect = new Mtk.Rectangle({x, y, width: w, height: h}); + rect = focusWindow.protocol_to_stage_rect(rect); + const windowActor = focusWindow.get_compositor_private(); + this._setDummyCursorGeometry( + windowActor.x + rect.x, + windowActor.y + rect.y, + rect.w, + rect.h); }); } catch (e) { // Only recent IBus versions have support for this signal